import { http } from './request.js';

// 分类相关API
export const categoryApi = {
    // 获取分类列表
    getCategories() {
        return http.get('/user/categories/list');
    },

    // 获取分类详情
    getCategoryById(id) {
        return http.get(`/user/categories/${id}`);
    },

    // 获取顶级分类
    getTopCategories() {
        return http.get('/user/categories/top');
    },

    // 获取子分类
    getChildCategories(parentId) {
        return http.get(`/user/categories/${parentId}/children`);
    },

    // 获取分类树
    getCategoryTree() {
        return http.get('/user/categories/tree');
    },

    // 分页获取分类
    getCategoryPage(params) {
        return http.get('/user/categories/page', params);
    },

    // 搜索分类
    searchCategories(keyword) {
        return http.get('/user/categories/search', { keyword });
    }
}; 